import { readOptions, businessStatusOptions } from "../options";
export default {
  data() {
    return {};
  },
  computed: {
    page() {
      const pathname = window.location.pathname;
      if (pathname.includes("my-department-notice")) {
        return true;
      }
      return false;
    },
    isNotice() {
      const pathname = window.location.pathname;
      if (pathname.includes("dep-notice-List")) {
        return true;
      }
      return false;
    },
    fileds() {
      return [
        {
          key: "title",
          filedType: "Input",
          layout: {
            span: 4,
          },
          itemProps: {
            prop: "title",
          },
          props: {
            placeholder: "请输入文件标题",
          },
        },
        // {
        //   key: "deptName",
        //   filedType: "Input",
        //   layout: {
        //     span: 4,
        //   },
        //   itemProps: {
        //     prop: "deptName",
        //   },
        //   props: {
        //     placeholder: "请输入所在部门",
        //   },
        // },
        {
          key: "time",
          filedType: "DatePicker",
          layout: { span: 6 },
          itemProps: {
            prop: "time",
          },
          props: {
            type: "daterange",
            placeholder: "请选择时间",
            rangeSeparator: "至",
            startPlaceholder: "开始日期",
            endPlaceholder: "结束日期",
            valueFormat: "yyyy-MM-dd",
          },
        },
        {
          key: "businessStatus",
          filedType: "Select",
          layout: {
            span: 4,
          },
          itemProps: {
            prop: "businessStatus",
          },
          props: {
            placeholder: "请选择状态",
            options: this.isNotice ? readOptions : businessStatusOptions,
          },
        },
      ];
    },
    column() {
      const data = [
        {
          type: "selection",
          width: "55",
        },
        {
          type: "index",
          width: "50",
          label: "序号",
        },
        {
          prop: "title",
          label: "文件标题",
        },
        {
          prop: "deptName",
          label: "所在部门",
        },
        {
          prop: "readStatus",
          label: "状态",
          isSlot: true,
        },
      ];
      const type1 = [
        {
          prop: "agentName",
          label: "发送人",
        },
        {
          prop: "createTime",
          label: "发送时间",
        },
      ];
      const type2 = [
        {
          prop: "agentName",
          label: "创建人",
        },
        {
          prop: "createTime",
          label: "创建时间",
        },
      ];
      const ope = {
        prop: "operate",
        label: "操作",
        isSlot: true,
      };
      return this.isNotice
        ? [...data, ...type1, ope]
        : [...data, ...type2, ope];
    },
  },
};
